#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(dead_code)]

use prost::Message;

extern crate alloc;

include!("./onnx.rs");

pub fn load(bytes: &[u8]) -> Result<ModelProto, prost::DecodeError> {
    ModelProto::decode(bytes)
}
pub fn opset_ai_onnx(model: &ModelProto) -> Option<i64> {
    model
        .opset_import
        .iter()
        .find(|d| d.domain.clone().unwrap().is_empty() || d.domain.clone().unwrap() == "ai.onnx")
        .map(|d| d.version)
        .unwrap_or(Some(13))
}
